export default {
  //开启命名空间
  namespaced : true,
  
  //数据
  state:() => ({
     address : JSON.parse(uni.getStorageSync('address') || '{}')
  }),
  
  mutations:{
    updateAddress(state,address){
       state.address = address
       this.commit('m_user/saveAddressToStoreage')
    },
    //持久化存储 address
    saveAddressToStoreage(state){
      uni.setStorageSync('address',JSON.stringify(state.address))
    }
  },
  
  getters:{
    addstr(state){
      if(state.address.province) return
      return state.address.provinceName + state.address.cityName + state.address.countryName + state.address.detailInfo
    }  
    
  }
}

